#ifndef OPEN_WEB_DIALOG_H
#define OPEN_WEB_DIALOG_H

extern "C" {
	#include "Matt/pdb.h"
}

enum PdbDatabase {
	DATABASE_DUNNO = 0,
	DATABASE_PDB,
	DATABASE_ASTRAL,
};

class FileRequest {
private:
	int ReadData();
public:
	wxString m_error;
	wxWindow *m_parent;
	wxString m_urlString;
	wxString m_name;
	PdbDatabase m_database;

	wxURL m_url;
	wxInputStream *m_is;

	unsigned char *m_buffer;
	int m_bufferSize;
	int m_maxBufferSize;
	bool m_newWindow;

	bool m_localFile;
	bool m_happy;
	bool m_busy;

	wxString m_path;

	FileRequest(wxWindow *parent, const wxString &url, const wxString &name, PdbDatabase database, const wxString &path, bool newWindow);
	int Update();

	~FileRequest();
};

FileRequest *OpenWebDialog(wxWindow *parent, int *newWindow, int forceNoNewWindow);
FileRequest *CreateFileRequest(wxString &name, wxWindow *parent, int noPopup = 1, bool newWindow = 0);

PDBData *LoadPDBFromString(const wxString &path);
#endif
